home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Grab Bag
/
Shareware Grab Bag.iso
/
002
/
chedit.arc
/
EXAMP1.C
< prev
next >
Wrap
C/C++ Source or Header
|
1986-04-20
|
3KB
|
65 lines
/*
Example program #1 from the CGRAPH documentation.
*/
/*
Compile this with your compiler, then Link it with the supplied object
modules.
*/
#include <stdio.h>
#include <chedit.h> /* Defines of the CHEDIT functions. Use it if your
compiler does strong type checking. */
#include <cgraph.c> /* The READCSET, WRITECSET, PRINTBANNER, and
PRINTCOLUMN routines are C source, included in
this file. */
#define CYAN 1
#define MAGENTA 2
#define WHITE 3 /* color definitions */
unsigned char shapes[1024]; /* the array to hold the character shapes */
int message[20]; /* the array to hold the message to be plotted */
int errno; /* to hold the return value from READCSET */
int i,m; /* loop indices */
unsigned long hold; /* temporary storage for saving the system
graphics character vector */
unsigned int ofs,seg; /* the ofset and segment of the saved system
vector */
main()
{
errno = readcset(shapes,"alpha.chr");
/* read the character set */
if (!errno) /* if all ok */
{
grmode(4); /* set to 320 x 200 graphics */
/* Use the routine appropriate to your compiler */
message[0] = 65; /* graphics character 65 */
message[1] = 67; /* etc. */
message[2] = 69;
hold = getvect(); /* save the system vector */
ofs = (unsigned int) (hold & 0xffff);
seg = (unsigned int) ((hold >> 16) & 0xffff);
setvect(shapes); /* and insert our own */
printbanner(2,5,message,2,CYAN);
/* print the message in color 1, cyan, at 2,5
on the screen. Note that this displays only
the first 2 characters, so the 3rd is "hidden" */
for (i = 0; i < 8*3*20; i++)
/* rotate through all 8 columns of the 3 chars
20 times */
{
for (m = 0; m < 1500; m++) ;
/* waste a little time */
bannerleft(shapes,message,3);
/* rotate all left so all characters take turns
being hidden */
printbanner(2,5,message,2,CYAN);
/* and display it again */
}
for (m = 0; m < 30000; m++) ;
/* one last time delay */
restorevect(ofs,seg); /* put the system vector back */
grmode(3); /* turn the graphics off */
/* use the routine appropriate to your compiler */
} /* end of the if */
} /* end of the program */